/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.io.File;

/**
 * <p>Project: javase - FileCount
 * <p>Powered by webrx On 2021-12-14 18:18:14
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class FileCount {
    static int num = 0;

    public static void main(String[] args) throws InterruptedException {
        //del(new File("c:/abcu.txt"));

        del("c:/xyz.rar");

    }

    public static void a() {
        //Thread.sleep(200);
        try {
            ++num;
            //System.out.printf("%tF %<tT%n", System.currentTimeMillis());
            a();
        } catch (Exception e) {
            System.out.println(num);
        }

    }

    public static void del(String file) {
        del(new File(file));
    }

    public static void del(File file) {
        if (file.isDirectory()) {
            for (File f : file.listFiles()) {
                if (f.isDirectory()) {
                    del(f);
                } else {
                    f.delete();
                }
            }
        }
        file.delete();
    }
}
